package com.exposit.zbs.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


public class MessageDigestHelper {

	public static String getMd5(String message) {

		MessageDigest md;
		String result = "";
		try {
			md = MessageDigest.getInstance("MD5");
			md.reset();
			md.update(message.getBytes());
			byte[] digest = md.digest();
			BigInteger bi = new BigInteger(1, digest);
			String hashText = bi.toString(16);
			while (hashText.length() < 32) hashText = "0" + hashText;
			result = hashText;
		} catch (NoSuchAlgorithmException ex) {
			System.out.println(ex.getStackTrace());
		}

		return result;


	}
}
